//
//  WSFactoryModel.m
//  LANGirl
//
//  Created by 吴帅 on 16/3/30.
//
//

#import "WSFactoryModel.h"

@implementation WSFactoryModel

// 根据字典内提供的数据分别创建出对应的model来获取数据
+ (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    // 先使用当前类（父类）创建出model对象
    WSFactoryModel *model = nil;
    
    // 根据字典中key对应的数据初始化不同的子类对象并将其返回给我们的父类
//    if ([dictionary[@"tag"] isEqualToString:@"Top News"]) {
//        model = [[OneModel alloc] init];
//    } else if ([dictionary[@"tag"] isEqualToString:@"imgextra"]){
//        model = [[TwoModel alloc] init];
//    } else if([dictionary[@"tag"] isEqualToString:@"music"]){
//        model = [[ThreeModel alloc] init];
//    }
    [model setValuesForKeysWithDictionary:dictionary];
    return model;
}

@end
